package com.foreknow.elmboot.mapper;
import com.foreknow.elmboot.po.DeliveryAddress;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeliveryAddressMapper {

    @Select("select * from deliveryaddress where userId=#{userId}")
    public List<DeliveryAddress> listDeliveryAddressByUserId(String userId);

    @Select("select * from deliveryaddress where daId=#{daId}")
    public DeliveryAddress getDeliveryAddressById(Integer daId);

    @Insert("insert into deliveryaddress(contactName,contactSex,contactTel,address,userId)  values(#{contactName},#{contactSex},#{contactTel},#{address},#{userId})")
    public int saveDeliveryAddress(DeliveryAddress deliveryAddress);

    @Update("update deliveryaddress set contactName=#{contactName} and  contactSex=#{contactSex} and contactTel=#{contactTel} and  address=#{address} and userId=#{userId}  where daId=#{daId} ")
    public int  updateDeliveryAddress(DeliveryAddress deliveryAddress);

    @Delete("delete from deliveryaddress where daId=#{daId} ")
    public  int removeDeliveryAddress(Integer daId);

}
